# -*- coding:utf-8 -*-
import pymongo
import urllib
import mongoDB
import sys

collections = sys.argv[1]
collection = mongoDB.connMongo(collections)
ret = collection.find().sort("value", -1).limit(50);
for item in ret:
    #print item['_id']['u']
    print urllib.unquote(item['_id']['u']) + " \t " + str(item['value']['count'])
